<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/JQuery/jquery.js"></script>
</head>

<body>
    <button id="btnPOST">发起POST请求</button>

    <script>
        $(function () {
            $("#btnPOST").on("click", function () {
                $.ajax({
                    type: "POST", // 请求方式    get 或者 post
                    url: "http://www.liulongbin.top:3006/api/addbook", // 访问网址
                    data: { // 发送指定id=1的数据
                        id: 999,
                        bookname: "史记",
                        author: "yyds",
                        publisher: "天津图书出版社"
                    },
                    // async: True, //异步
                    success: function (res) { // 请求之后的回调函数

                        console.log(res);
                    }
                })
            })
        })
    </script>
</body>

</html>